package com.demo.order_service.enums;

import org.springframework.http.HttpStatus;

public enum ResultEnum {
    /*
      删除增加修改相关
     */
    ORDER_STATUS_SUCCESS("SUC_701", "ORDER_STATUS_SUCCESS", HttpStatus.OK, "成功:{%s}"),
    ORDER_STATUS_FAIL_CHECK("SUC_702", "ORDER_STATUS_FAIL_CHECK", HttpStatus.BAD_REQUEST, "业务检查失败：{%s}"),

    /*
      异常相关
     */
    EXC_DB("EXC_001", "EXC_DB", HttpStatus.INTERNAL_SERVER_ERROR, "数据库异常：{%s}"),
    EXC_REMOTE("EXC_002", "EXC_REMOTE", HttpStatus.INTERNAL_SERVER_ERROR, "远程调用异常：{%s}"),
    EXC_ELSE("EXC_009", "EXC_ELSE", HttpStatus.INTERNAL_SERVER_ERROR, "其他异常：{%s}"),;

    private String code;//编号

    private String name;//名称

    private HttpStatus httpStatus;//http状态码

    private String msgPattern;//返回消息的样式

    ResultEnum(String code, String name, HttpStatus httpStatus, String msgPattern) {
        this.code = code;
        this.name = name;
        this.httpStatus = httpStatus;
        this.msgPattern = msgPattern;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public HttpStatus getHttpStatus() {
        return httpStatus;
    }

    public String getMsgPattern() {
        return msgPattern;
    }
}